package store.lunangangster.engine.impl.bpmn.behavior;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import store.lunangangster.engine.impl.Context;
import store.lunangangster.engine.impl.entity.ExecutionEntity;

public class IntermediateCatchEventBehavior extends EventBehavior {

  private static final Logger log = LoggerFactory.getLogger(IntermediateCatchEventBehavior.class);

  @Override
  public void doBehavior(ExecutionEntity execution) {
    // default: do nothing, and wait to trigger
  }

  @Override
  public void trigger(ExecutionEntity execution) {
    log.debug("{}捕获", execution.getCurrentFlowElement());

    Context.getProcessEngineConfiguration()
        .getHistoryManager()
        .createNewHistory(execution, execution.getCurrentFlowElement(), "CATCH");

    goNext(execution);
  }
}
